﻿package com.pool.data
{
	public class UserData
	{
		public var netkey:String = "";
		
		public var uID:uint;//UID
		public var nick:String;//昵称
		public var gameSite:String;//分站
		public var extID:uint;//ExtID
		
		public var sex:int;//性别
		public var headImg:String;//头像
		public var headUrl:String;//虚拟形象
		public var mem:int;//会员级别
		public var level:int;//社区级别
		public var exp:int;//社区经验值
		public var credit:int;//人气
		public var title:String;//自定义称号
		
		public var state:int=1;//当前玩家状态，0为已登陆但不在房间，1为在房间，2为已在桌子上没准备，3为玩家在桌子上已经准备没有开始游戏，4为玩家正在游戏中
		
		public function UserData(pnetkey:String= "",source:Array=null)
		{
			netkey = pnetkey;
			if(source!=null)
			{
				SetAsArray(source);
			}
		}

		public function SetAsArray(source:Array):void
		{
			uID = getPro(source, 0);
			nick = getPro(source, 1);
			gameSite = getPro(source, 2);
			extID = getPro(source, 3);
			
			sex = getPro(source, 4);
			headImg = getPro(source, 5);
			headUrl = getPro(source, 6);
			mem = getPro(source, 7);
			level = getPro(source, 8);
			exp = getPro(source, 9);
			credit = getPro(source, 10);
			title = getPro(source, 11);
		}
		
		private function getPro(source:Array,pos:int):* 
		{
			if (pos<source.length&&pos>=0) return source[pos];
			return null;
		}
		
		public function GetAsArray():Array
		{
			return [uID,nick,gameSite,extID,sex,headImg,headUrl,mem,level,exp,credit,title];
		}
	}
}